//api文件夹用于存放对后台请求的代码
import service from ".";//导入

const studentApi = {
    //增加
    insert(student) {
        //发送axios请求给服务器
        return service.post('/admin/student/insert', student);
    },
    //根据id删除
    delete(sid) {//删除和根据id查要用反引号
        return service.delete(`/admin/student/${sid}`);
    },
    //修改
    update(student) {
        return service.put('/admin/student/update', student);
    },

    //分页查询
    //get请求获取参数
    selectByPage(PageNum, sname,sgender) {
        return service.get('/admin/student/selectByPage', {
            params: {
                PageNum:PageNum ,
                sname:sname,
                sgender,sgender
            }
        });
    },

    //根据id查询
    selectBySid(sid) {
        return service.get(`/admin/student/${sid}`);
    },
    download(){
        return service.get('/admin/upload/download',{
            responseType:'blob'
        })
    }
};

export default studentApi;//导出